
package com.kzj.mls.global;

import java.util.HashMap;

public class Constant {

    /**
     * 系统环境配置常量
     */
    public static class SystemContext {

        public static final boolean isChooseService = true;// 调试模式，发版要改false
        public static final boolean isDebugLog = true;// 是否打印日志 测试阶段 无论是否打包 最好都打开/
        public static boolean isDebugShowToast = false;// 是否打印日志
        public static boolean isSendGongGao = false;// 是否打印日志
        public static final String encodeStyle = "UTF-8";
        public static final String SuccessState = "true"; // 请求成功
        // 	public static  String ROOT_URL_VALUE = "http://new.legacy.hk"; // 测试服务器
        public static final String OfficialUrl = "http://test.lmmb365.com/meiti.php?"; // 正式服务器
        public static final String TestUrl = "http://test.lmmb365.com/meiti.php?"; // 测试环境
        public static String ROOT_URL_VALUE = OfficialUrl;

        // public static String ROOT_URL_VALUE = "http://192.168.70.6:8080/lmm.php?"; // 测试环境

        public static String UserCheck = "user_checked";
        public static final String UserBean = "user_bean";
        public static String WXID = "wx850354fd4bd84888";
        public static String WXKey = "N8rmdcYQRtaPaldCA4foJB3Bz0elW1EAVR3wEuwpUig8BY6d3BelPhrWQDPlw5wLx7Ah9FIze1QO7cGYbkAMuqwUbQqXK5cubSyBj1HE7w5opViOOt3ZA1267IrWBG8o";
    }

    /**
     * 接口.
     */
    public static class Action {

        public static final String Action_ad_list = "app=d&act=ad_list";//首页广告轮播
        public static final String Action_config_city = "app=d&act=config_city";//开通城市
        public static final String Action_config_serviceDetail = "app=d&act=serviceDetail";//服务详情
        public static final String Action_serviceList = "app=d&act=serviceList";//首页6个服务图
        public static final String Action_booking = "app=m&act=booking";//预约信息
        public static final String Action_Order_Choose_Time = "app=m&act=booking_time";
        public static final String Action_Send_Code = "act=sendMessage";//发送验证码
        public static final String Action_Login = "app=m&act=login";
        public static final String Action_Coupon_List = "app=m&act=couponList";
        public static final String Action_Address_List = "app=m&act=myAddress";
        public static final String Action_Edit_Address = "app=m&act=setAddress";
        public static final String Action_Add_Address = "app=m&act=setAddress&flag=add";
        public static final String Action_Delete_Address = "app=m&act=dropAddress";
        public static final String Action_Order_List = "app=m&act=myOrder";
        public static final String Action_Cancle_Order = "app=m&act=orderCancel";
        public static final String Action_Delete_Order = "app=m&act=deleteOrder";
        public static final String Action_Order_Pay_Alibaba = "app=m&act=alipay";
        public static final String Action_Order_Pay_WeiXin = "app=m&act=weixin_pay";
        public static final String Action_Order_Save = "app=m&act=saveOrder";
        public static final String Action_Suggest = "app=m&act=saveFeedBack";
        public static final String Action_Evaluation = "app=m&act=saveOrderEvaluation";
        public static final String Action_ChangeName = "app=m&act=member_name";
        public static final String Action_UpdateHeadImage = "app=m&act=member_portrait";

        public static final String Action_Set_Service = "app=m&act=setService";//设置服务
        public static final String Action_Service_List = "app=m&act=serviceList";//服务列表
        public static final String Action_FundManage = "app=m&act=fundManage";//资金管理 0全部 1'待结算', '2可结算', '3已结算'
        public static final String Action_Order_Details = "app=m&act=orderDetail";//订单详情
        public static final String Action_Schedule = "app=m&act=schedule";
        public static final String Action_SetSchedule = "app=m&act=setSchedule";
        public static final String Action_Confirm_Order = "app=m&act=confirmOrder";
        public static final String Action_Complete_Order = "app=m&act=finishOrder";
        public static final String Action_Index = "app=m&act=index";
    }

    /**
     * 接口名称和参数,参数顺序必须与这里保持一致
     */
    public static HashMap<String, String[]> paramsMap = new HashMap<String, String[]>() {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        {
            //link.type的取值（0-普通产品;1-类型馆;2-整个店铺）;
            //link.id的取值（当link.type为0时取产品的id；为2时,0-潮玩馆;1-时尚馆;2-人文馆；为3时,取值为登录用户的店铺id）。
            //  put(Action.Action_Login, new String[]{"name", "password", "rememberMe"});//是否带token，如果rememberMe=1, 则在登录成功后在Hearder中包含有token
            put(Action.Action_ad_list, new String[]{""});
            put(Action.Action_config_city, new String[]{""});
            put(Action.Action_serviceList, new String[]{""});
            put(Action.Action_config_serviceDetail, new String[]{"id"});
            put(Action.Action_booking, new String[]{"lng", "lat", "goods_id", "region_name"});
            put(Action.Action_Order_Pay_Alibaba, new String[]{"order_id"});
            put(Action.Action_Order_Pay_WeiXin, new String[]{"order_id"});
            put(Action.Action_Order_Choose_Time, new String[]{"lng", "lat", "goods_id", "region_name", "date"});
            put(Action.Action_Send_Code, new String[]{"phone"});
            put(Action.Action_Login, new String[]{"user_name", "verify_code"});
            put(Action.Action_Address_List, new String[]{"user_checked"});
            put(Action.Action_Coupon_List, new String[]{"page"});
            put(Action.Action_Edit_Address, new String[]{"addr_id", "address"});
            put(Action.Action_Add_Address, new String[]{"address", "region_name"});
            put(Action.Action_Delete_Address, new String[]{"addr_id"});
            put(Action.Action_Order_Save, new String[]{"goods_id", "real_name", "phone_mob", "booking_date", "booking_time", "site_type", "addr_id", "store_id", "coupon_id", "payment_code", "order_source"});

            put(HTML5.Html5_serviceDetail, new String[]{"id", "city", "lng", "lat", "app_source"});
            put(Action.Action_Order_List, new String[]{"page", "status"});
            put(Action.Action_Delete_Order, new String[]{"order_id"});
            put(Action.Action_Cancle_Order, new String[]{"order_id"});
            put(Action.Action_Confirm_Order, new String[]{"order_id"});
            put(Action.Action_Suggest, new String[]{"content"});
            put(Action.Action_Evaluation, new String[]{"order_id", "goods", "store", "content"});
            put(Action.Action_ChangeName, new String[]{"store_name"});
            //
            put(Action.Action_FundManage, new String[]{"status"});

            put(Action.Action_Set_Service, new String[]{"goods_id"});
            put(Action.Action_Service_List, new String[]{null});
            put(Action.Action_Order_Details, new String[]{"order_id"});
            put(Action.Action_Schedule, new String[]{null});
            put(Action.Action_SetSchedule, new String[]{"date_id", "time_id", "weekid", "month_id"});
            put(Action.Action_Confirm_Order, new String[]{"order_id"});
            put(Action.Action_Index, new String[]{"page"});
            put(Action.Action_Complete_Order, new String[]{"order_id"});
        }
    };

    /*
 * Html5页面
 */
    public static class HTML5 {

        public final static String Html5_serviceDetail = "app=d&act=serviceDetail&";
    }

    public static String getRootUrl() {
    /*	String rootUrl = AbSharedUtil.getString(AppConfig.getInstance()
                .getApplicationContext(), SystemContext.ROOT_URL_KEY);
		if (!TextUtils.isEmpty(rootUrl)) {
			return rootUrl;
		} else {
			return SystemContext.ROOT_URL_VALUE;
		}*/
        return SystemContext.ROOT_URL_VALUE;
    }

    public static String getHtml5UrlFotParameter(String key, String... paramsValue) {
        if (paramsValue.length == 0) { //参数为空的话直接访问
            return key;
        }
        String[] values = Constant.paramsMap.get(key);
        String parameter = "";
        if (values != null) {
            int i = 0;
            for (; i < paramsValue.length; i++) {
                parameter += values[i] + "=" + paramsValue[i] + "&";
            }
        }
        String paramsUrl = key + parameter.substring(0, parameter.length() - 1);
        return SystemContext.ROOT_URL_VALUE + paramsUrl;
    }
}
